import Vue from "vue";
import VueRouter from "vue-router";
import index from "../views/index.vue";
import login from "../views/login.vue";
import addUser from "../components/system/add.vue";
import changeUser from "../components/system/change.vue";
import deleteUser from "../components/system/delete.vue";
import queryUser from "../components/system/query.vue";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "index",
    component: index,
    children: [
      {
        path: "addUser",
        name: "addUser",
        component: addUser,
        meta: {
          title: "add",
        },
      },
      {
        path: "changeUser",
        name: "changeUser",
        component: changeUser,
        meta: {
          title: "change",
        },
      },
      {
        path: "deleteUser",
        name: "deleteUser",
        component: deleteUser,
        meta: {
          title: "delete",
        },
      },
      {
        path: "queryUser",
        name: "queryUser",
        component: queryUser,
        meta: {
          title: "query",
        },
      },
    ],
    meta: {
      title: "index",
    },
  },
  {
    path: "/login",
    name: "login",
    component: login,
    meta: {
      title: "login",
    },
  },
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
